<script src="/javascripts/util.js" type="text/javascript"></script>
<script src="/javascripts/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
    function checkDate(){
        /*
        if(document.getElementById("beginDate").value!='' && document.getElementById("endDate").value!=''){
            if (!dateCheck(document.getElementById("beginDate").value))
                alert("开始时间不合法！输入格式为yyyy-mm-dd。");
            else if(!dateCheck(document.getElementById("endDate").value))
                alert("结束时间不合法！输入格式为yyyy-mm-dd。");   
            else
                frmQuery.submit();
        }
        else if(document.getElementById("beginDate").value=='' && document.getElementById("endDate").value=='')
            frmQuery.submit();
        else
                alert("开始时间与结束时间必须全部输入！");
        */
        frmQuery.submit();
    }
</script>
<h1>报表中心 - <span id="secondHeading">客户统计</span></h1>
<form id="input-form" action="/query/agent_total" name= "frmQuery" method="post">
<TABLE border="0" id="INPUT_TABLE">
		<tr><td colspan="2">
			<% if @flash[:notice] -%>
					<div id="notice"><%= @flash[:notice] %></div>
				<% end -%>
			</td>
		</tr>
	<TR>
		<TD width="20%">起始时间：</TD>
                <TD>        
                        <!-- <input id="beginDate" type="text" name="from"> -->
                        <script language=javascript>
                                var beignDate=new dateSelector();
                                beignDate.inputID='beginDate';
                                beignDate.inputName='from';
                                beignDate.display();
                        </script></TD>
	</TR>
	<TR>
                <TD>结束时间：</TD>
                <TD>        
                        <!--<input id="endDate" type="text" name="to">-->
                        <script language=javascript>
                                var endDate=new dateSelector();
                                endDate.inputID='endDate';
                                endDate.inputName='to';
                                endDate.display();
                        </script>
                </TD>
	</TR>
	<TR><TD colspan="2" align="right"><input type="button" value="查询" class="sub" onclick="checkDate()"></TD></TR>
	<%=end_form_tag%>
</TABLE>
<%if @totalIn%>
</p>
<TABLE border="0" id="LIST_TB">
        <TR id="LIST_TB_TITLE">
	<TD colspan="3">起始时间：<%=params[:from]%>至<%=params[:to]%></TD>
	</TR>
	<TR id="LIST_TB_TITLE">
		<TD>客户</TD>
		<TD>提货数量（kpcs）</TD>
		<TD>提货金额（元）</TD>
	</TR>

	<%@totalIn.each do |item|%>
	<TR id="LIST_TB_CONTENT1">
                
		<TD><%=item.name%></TD>
		<TD><%=item.count%></TD>
		<TD><%=item.price%></TD>
	</TR>
	<%end%>
</TABLE>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                        <input type="button" value="导出当前数据" class="sub" onclick="CellAreaExcel('LIST_TB')"/>
                </td>
        </tr>
</table>
<%end%>
